<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let str = "海賊王、俺は成る！";

        // for...in 可以遍历索引
        for (let i in str) {
            console.log(i);
        }

        // ES6中，可以使用for...of遍历字符串的值
        for (let v of str) {
            console.log(v);
        }
    </script>
</body>
</html>